package ioperations;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class ReturnOp implements IOperation{
    @Override
    public void work(BookList books) {
        System.out.println("Return a book");
        System.out.println("借还的书名：");
        Scanner scan = new Scanner(System.in);
        String name = scan.nextLine();
        boolean find = false;
        Book[] book = books.getList();
        for(Book tmp : book){
            if(name.equals(tmp.getBookname())){
                tmp.setBorrowed(false);
                System.out.println("归还成功："+tmp);
                return;
            }
        }
        System.out.println("图书管没有这本书。");
    }
}
